package com.soundShape.utils
{
	
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;
	
	import mx.core.UIComponent;
	
	public class DropDragger
	{
		public function DropDragger()
		{
		}
		
		
		// mouseDown="DropDragger.doDragDrop(event)" mouseUp="DropDragger.doDragDrop(event)" 
		
		public static function doDragDrop(mouseEvent:MouseEvent, rectangle:Rectangle=null):void
        {
        	
			//trace(typeof(mouseEvent.currentTarget));
			
			
			if(mouseEvent.type == MouseEvent.MOUSE_DOWN)
        	{
        		UIComponent(mouseEvent.currentTarget).startDrag(false,rectangle);
        	}
        	else if(mouseEvent.type == MouseEvent.MOUSE_UP)
        	{
        		UIComponent(mouseEvent.currentTarget).stopDrag();
        		
        		//CONFIG::debugging { this.logger.debug(UIComponent(mouseEvent.currentTarget).id + " " + UIComponent(mouseEvent.currentTarget).x + " " + UIComponent(mouseEvent.currentTarget).y ); }
        		
        		/* CONFIG::debugging this.logger.debug("{object:" + UIComponent(mouseEvent.currentTarget).id + ", " +
        		 	"x:" + UIComponent(mouseEvent.currentTarget).x + ", " + 
        			"y:" + UIComponent(mouseEvent.currentTarget).y  + "}"); */
        			
        		trace('{object:' + UIComponent(mouseEvent.currentTarget).id + ', ' +
        		 	'x="' + UIComponent(mouseEvent.currentTarget).x + '" ' + 
        			'y="' + UIComponent(mouseEvent.currentTarget).y  + '"}');
        			
        	}
        }

	}
}